<?php

header('Content-Type:text/html;charset=utf-8');

@$a=$_POST['cplx'];



$PDO=new PDO('mysql:dbname=diancan;charset=UTF8;','root');

$sou=$PDO->prepare('select * from VTtype where typename=:aa');
$sou->execute(array('aa'=>$a));
$cc=$sou->fetchAll(PDO::FETCH_NAMED);
if (empty($cc)) {
	$sou=$PDO->prepare('insert into vttype(typename) values(:aa)');
	$sou->execute(array('aa'=>$a));
	echo "添加菜品类型成功！";
	header('Refresh:2;url=cpgl.php');
}else{
	echo "菜品类型已存在！";
	header('Refresh:2;url=cpgl.php');
}

	

?>